package org.testis.gui.mvc.utilities;

/*
 * 
 * @author nurhat Edit: Cahit Emir Erel
 */
import java.io.PrintStream;

public class GUIMessageListener
//implements MessageListener
{

    //  private Connection connection;
    //  private Session session;
    //  private MessageConsumer consumer;
    SystemOutReader m_reader;
    PrintStream m_console;


    public void init() throws Exception
    {
        /* ActiveMQConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory("failover:tcp://10.11.12.2:61616?wireFormat.maxInactivityDuration=0");
        //new ActiveMQConnectionFactory("tcp://192.168.2.12:61616");
        connection = connectionFactory.createConnection();
        session = connection.createSession(false,
        Session.AUTO_ACKNOWLEDGE);
        Topic request = session.createTopic("logger_topic");
        consumer = session.createConsumer(request);
        consumer.setMessageListener(this);
        connection.start();*/
        m_reader = new SystemOutReader();
        m_console=DebugLogger.getInstance();
        System.setOut(m_reader);
    }


    public void destroy() throws Exception
    {
        System.setOut(m_console);
    }


    /*@SuppressWarnings("empty-statement")
    public void onMessage(Message message)
    {
    synchronized (this) {
    try {
    ObjectMessage objMsg = (ObjectMessage) message;
    LogData logData = (LogData) objMsg.getObject();
    TestDesignControllerList.newInstance().
    getRunningTestSuiteController().operationChangeOutput(
    logData.getPrintMessage());
    } catch (JMSException ex) {
    ex.printStackTrace();
    }
    }
    }
    
     */
    public static void main(String[] args) throws Exception
    {
        GUIMessageListener call = new GUIMessageListener();
        call.init();
    }
}
